const uploadImage = async (req, res) => {
    // console.log('req.files:', req.files);  // 打印 req.files
    // console.log('req.body:', req.body);    // 打印 req.body

    if (!req.files || req.files.length === 0) {
        return res.status(400).json({ success: false, message: "No files uploaded" });
    }

    // 返回每个文件的访问 URL
    const imageUrls = req.files.map(file => `/uploads/${file.filename}`);
    
    // 假设后续还会用到这些 URL 存储在数据库等地方
    return res.status(200).json({ success: true, message: "Files uploaded successfully", imageUrls });
};
module.exports = { uploadImage };
